package main

import "fmt"

/*
* Author: JacksonCoder
* CreateTime: 2025/5/20
 */

// 定义接口
type Skills interface {
	Running()
	GetName() string
}

type Student struct {
	Name string
	Age  int
}

type Teacher struct {
	Name string
	Age  int
}

// 实现接口
func (s Student) GetName() string {
	//实现Getname方法
	fmt.Println(s.Name)
	return s.Name
}

func (s Student) Running() {
	// 实现 Running方法
	fmt.Printf("%s running \n", s.Name)
}

func (t Teacher) GetName() string {
	//
	fmt.Println(t.Name)
	return t.Name
}

func (t Teacher) Running() {
	fmt.Printf("%s running\n", t.Name)
}

func (t Teacher) Running2() {
	fmt.Printf("%s running2 \n", t.Name)
}

// 想要接口，那就要实现对应接口的所有方法
func main() {
	var skill Skills // 一个接口变量
	var stu Student  //  结构体变量
	stu.Name = "alen"
	stu.Age = 3294
	skill = stu
	skill.Running() // 调用接口

	var teacher Teacher = Teacher{"chris", 18}
	skill = teacher
	skill.Running() // 调用接口
	teacher.Running()

}
